package polymorphism;

/**
 * Created by admin on 2016-11-17.
 */
class Worker extends Person{

    private String company;

    private int workTime;

    Worker(){}

    Worker(String name,String sex,int age,String nationality,String company,int workTime ){
        super(name,sex,age,nationality);

        this.company=company;

        this.workTime=workTime;
    }

    public void work(){
        System.out.println(getName()+"'s work is program");
    }

    public String getCompany() {
        return company;
    }

    public Worker setCompany(String company) {
        this.company = company;
        return this;
    }

    public int getWorkTime() {
        return workTime;
    }

    public Worker setWorkTime(int workTime) {
        this.workTime = workTime;
        return this;
    }

    public String toString(){
        return super.toString()+" Worker company:"+company+" worktime:"+workTime;
    }
}